package model

import (
	"fmt"
	"github.com/go-redis/redis/v8"
)

var RedisClient *redis.Client

// databese.RedisClient.Set(nil, "hjl", "666666666", 1*time.Hour)
// hjl := databese.RedisClient.Get(nil, "hjl")
func Redis_Client() {
	// 创建一个 Redis 客户端
	RedisClient = redis.NewClient(&redis.Options{
		//Addr: "47.104.190.71:6379",
		Addr: "47.104.190.71:6379",
		DB:   0,
	})
	// 测试连接
	pong, err := RedisClient.Ping(RedisClient.Context()).Result()
	if err != nil {
		fmt.Printf("Redis连接失败 : %v\n", err)
	} else {
		fmt.Printf("Redis连接成功:%v\n", pong)
	}

}
